package com.zlx.mall.biz.order.enums;

import lombok.Getter;

/**
 * @Author xiatian
 * @Date 2025/3/28 星期五 22:54
 * @注释
 */
@Getter
public enum OrderStatusEnum {
    //0-已提交，1-待收货，2-已完成，3-已取消
    INIT(0,"已提交"),
    WAITING_RECEIVE(1,"待收货"),
    COMPLETE(2,"已完成"),
    CANCEL(3,"已取消"),
    ;
    private Integer code;
    private String desc;

    OrderStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static String getStatusDescByCode(Integer code) {
        for (OrderStatusEnum statusEnum : values()) {
            if (statusEnum.getCode().equals(code)) {
                return statusEnum.getDesc();
            }
        }
        return "未查询到对应的状态";
    }
}
